<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui">

    <h:head> </h:head>
    <h:body>
        <h2>Registration Form</h2>
        <h:form>
            <p:fieldset legend="Registration Form" widgetVar="regWidget" style="width: 600px;">
                <h:panelGrid columns="3" width="550" border="0">
                    <h:outputLabel value="UserName"/>
                    <p:inputText value="" id="userName" required="true"
                        requiredMessage="UserName is required"
                        validatorMessage="UsesrName should be of length from 5 to 15 chars">
                        <f:validateLength minimum="5" maximum="15" for="userName"/>
                    </p:inputText>
                    <p:message for="userName"/>


                    <h:outputLabel value="Password"/>
                    <p:password value="" id="password" required="true"
                        requiredMessage="Password is required"
                        validatorMessage="Password should be of length from 5 to 15 chars">
                        <f:validateLength minimum="5" maximum="15" for="password"/>
                    </p:password>
                    <p:message for="password"/>

                    <h:outputLabel value="FirstName"/>
                    <p:inputText value="" id="firstName" required="true"
                        requiredMessage="FirstName is required"
                        validatorMessage="FirstName should be of length from 5 to 15 chars">
                        <f:validateLength minimum="5" maximum="15" for="firstName"/>
                    </p:inputText>
                    <p:message for="firstName"/>


                    <h:outputLabel value="LastName"/>
                    <p:inputText value="" id="lastName"/>
                    <p:message for="lastName"/>

                    <h:outputLabel value="Email"/>
                    <p:inputText value="" id="email" validatorMessage="Invalid Email">
                        <f:validateRegex pattern="[a-zA-Z0-9]+@[a-zA-Z]+.[a-zA-Z]{2,3}"/>
                    </p:inputText>
                    <p:message for="email"/>

                    <h:outputLabel value="Phone"/>
                    <p:inputText value="" id="phone"/>
                    <p:message for="phone"/>

                    <h:outputLabel value="DOB"/>
                    <p:calendar value="#{java.util.Date}" id="dob" converterMessage="Invalid Date"
                        pattern="dd-MM-yyyy"> </p:calendar>
                    <p:message for="dob"/>

                    <h:outputLabel value="Gender"/>
                    <h:selectOneRadio id="gender" value="male">
                    	<f:selectItem itemLabel="Male" itemValue="male" />
                    	<f:selectItem itemLabel="Female" itemValue="female" />   
                    </h:selectOneRadio>
                    <p:message for="gender"/>

                    <p:commandButton value="Register" action="#{registrationBean.register}"
                        ajax="false"/>
                </h:panelGrid>
            </p:fieldset>

        </h:form>
    </h:body>
</html>